home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.0 / PInterfaces / Editions.p < prev    next >
Encoding:
Text File  |  1995-04-18  |  13.3 KB  |  427 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Editions.p
  3.  
  4.      Contains:    Edition Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT Editions;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __EDITIONS__}
  30. {$SETC __EDITIONS__ := 1}
  31.  
  32. {$I+}
  33. {$SETC EditionsIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __MEMORY__}
  38. {$I Memory.p}
  39. {$ENDC}
  40. {    Types.p                                                        }
  41. {        ConditionalMacros.p                                        }
  42. {    MixedMode.p                                                    }
  43.  
  44. {$IFC UNDEFINED __TYPES__}
  45. {$I Types.p}
  46. {$ENDC}
  47.  
  48. {$IFC UNDEFINED __FILES__}
  49. {$I Files.p}
  50. {$ENDC}
  51. {    OSUtils.p                                                    }
  52.  
  53. {$IFC UNDEFINED __ALIASES__}
  54. {$I Aliases.p}
  55. {$ENDC}
  56. {    AppleTalk.p                                                    }
  57.  
  58. {$IFC UNDEFINED __DIALOGS__}
  59. {$I Dialogs.p}
  60. {$ENDC}
  61. {    Errors.p                                                    }
  62. {    Windows.p                                                    }
  63. {        Quickdraw.p                                                }
  64. {            QuickdrawText.p                                        }
  65. {        Events.p                                                }
  66. {        Controls.p                                                }
  67. {            Menus.p                                                }
  68. {    TextEdit.p                                                    }
  69.  
  70. {$PUSH}
  71. {$ALIGN MAC68K}
  72. {$LibExport+}
  73.  
  74. CONST
  75. { resource types  }
  76.     rSectionType                = 'sect';                        { ResType of saved SectionRecords }
  77. { Finder types for edition files }
  78.     kPICTEditionFileType        = 'edtp';
  79.     kTEXTEditionFileType        = 'edtt';
  80.     ksndEditionFileType            = 'edts';
  81.     kUnknownEditionFileType        = 'edtu';
  82.     kPublisherDocAliasFormat    = 'alis';
  83.     kPreviewFormat                = 'prvw';
  84.     kFormatListFormat            = 'fmts';
  85.  
  86. { section types }
  87.     stSubscriber                = $01;
  88.     stPublisher                    = $0A;
  89.     sumAutomatic                = 0;                            { subscriber update mode - Automatically     }
  90.     sumManual                    = 1;                            { subscriber update mode - Manually }
  91.     pumOnSave                    = 0;                            { publisher update mode - OnSave            }
  92.     pumManual                    = 1;                            { publisher update mode - Manually }
  93.     kPartsNotUsed                = 0;
  94.     kPartNumberUnknown            = -1;                            { misc }
  95.     kPreviewWidth                = 120;
  96.     kPreviewHeight                = 120;
  97. { bits for formatsMask }
  98.     kPICTformatMask                = 1;
  99.     kTEXTformatMask                = 2;
  100.     ksndFormatMask                = 4;
  101. { pseudo-item hits for dialogHooks 
  102.  the first if for NewPublisher or NewSubscriber Dialogs }
  103.     emHookRedrawPreview            = 150;
  104. { the following are for SectionOptions Dialog }
  105.     emHookCancelSection            = 160;
  106.     emHookGoToPublisher            = 161;
  107.     emHookGetEditionNow            = 162;
  108.     emHookSendEditionNow        = 162;
  109.     emHookManualUpdateMode        = 163;
  110.     emHookAutoUpdateMode        = 164;
  111.  
  112. { the refcon field of the dialog record during a modalfilter 
  113.  or dialoghook contains one the following }
  114.     emOptionsDialogRefCon        = 'optn';
  115.     emCancelSectionDialogRefCon    = 'cncl';
  116.     emGoToPubErrDialogRefCon    = 'gerr';
  117.     kFormatLengthUnknown        = -1;
  118.  
  119. { one byte, stSubscriber or stPublisher }
  120.     
  121. TYPE
  122.     SectionType = SignedByte;
  123.  
  124. { seconds since 1904 }
  125.     TimeStamp = LONGINT;
  126.  
  127. { similar to ResType }
  128.     FormatType = FourCharCode;
  129.  
  130. { used in Edition I/O }
  131.     EditionRefNum = Handle;
  132.  
  133. { update modes }
  134. { sumAutomatic, pumSuspend, etc }
  135.     UpdateMode = INTEGER;
  136.  
  137.     SectionPtr = ^SectionRecord;
  138.     SectionHandle = ^SectionPtr;
  139.  
  140.     SectionRecord = RECORD
  141.         version:                SignedByte;                                { always 0x01 in system 7.0 }
  142.         kind:                    SectionType;                            { stSubscriber or stPublisher }
  143.         mode:                    UpdateMode;                                { auto or manual }
  144.         mdDate:                    TimeStamp;                                { last change in document }
  145.         sectionID:                LONGINT;                                { app. specific, unique per document }
  146.         refCon:                    LONGINT;                                { application specific }
  147.         alias:                    AliasHandle;                            { handle to Alias Record }
  148.         subPart:                LONGINT;                                { which part of container file }
  149.         nextSection:            SectionHandle;                            { for linked list of app's Sections }
  150.         controlBlock:            Handle;                                    { used internally }
  151.         refNum:                    EditionRefNum;                            { used internally }
  152.     END;
  153.  
  154.     EditionContainerSpec = RECORD
  155.         theFile:                FSSpec;
  156.         theFileScript:            ScriptCode;
  157.         thePart:                LONGINT;
  158.         thePartName:            Str31;
  159.         thePartScript:            ScriptCode;
  160.     END;
  161.  
  162.     EditionContainerSpecPtr = ^EditionContainerSpec;
  163.  
  164.     EditionInfoRecord = RECORD
  165.         crDate:                    TimeStamp;                                { date EditionContainer was created }
  166.         mdDate:                    TimeStamp;                                { date of last change }
  167.         fdCreator:                OSType;                                    { file creator }
  168.         fdType:                    OSType;                                    { file type }
  169.         container:                EditionContainerSpec;                    { the Edition }
  170.     END;
  171.  
  172.     NewPublisherReply = RECORD
  173.         canceled:                BOOLEAN;                                { O }
  174.         replacing:                BOOLEAN;
  175.         usePart:                BOOLEAN;                                { I }
  176.         filler:                    SInt8;
  177.         preview:                Handle;                                    { I }
  178.         previewFormat:            FormatType;                                { I }
  179.         container:                EditionContainerSpec;                    { I/O }
  180.     END;
  181.  
  182.     NewSubscriberReply = RECORD
  183.         canceled:                BOOLEAN;                                { O }
  184.         formatsMask:            SignedByte;
  185.         container:                EditionContainerSpec;                    {I/O}
  186.     END;
  187.  
  188.     SectionOptionsReply = RECORD
  189.         canceled:                BOOLEAN;                                { O }
  190.         changed:                BOOLEAN;                                { O }
  191.         sectionH:                SectionHandle;                            { I }
  192.         action:                    ResType;                                { O }
  193.     END;
  194.  
  195.     ExpModalFilterProcPtr = ProcPtr;  { FUNCTION ExpModalFilter(theDialog: DialogPtr; VAR theEvent: EventRecord; itemOffset: INTEGER; VAR itemHit: INTEGER; yourDataPtr: Ptr): BOOLEAN; }
  196.     ExpDlgHookProcPtr = ProcPtr;  { FUNCTION ExpDlgHook(itemOffset: INTEGER; itemHit: INTEGER; theDialog: DialogPtr; yourDataPtr: Ptr): INTEGER; }
  197.     ExpModalFilterUPP = UniversalProcPtr;
  198.     ExpDlgHookUPP = UniversalProcPtr;
  199.  
  200. CONST
  201.     uppExpModalFilterProcInfo = $0000FBD0; { FUNCTION (4 byte param, 4 byte param, 2 byte param, 4 byte param, 4 byte param): 1 byte result; }
  202.     uppExpDlgHookProcInfo = $00003EA0; { FUNCTION (2 byte param, 2 byte param, 4 byte param, 4 byte param): 2 byte result; }
  203.  
  204. FUNCTION NewExpModalFilterProc(userRoutine: ExpModalFilterProcPtr): ExpModalFilterUPP;
  205.     {$IFC NOT GENERATINGCFM }
  206.     INLINE $2E9F;
  207.     {$ENDC}
  208.  
  209. FUNCTION NewExpDlgHookProc(userRoutine: ExpDlgHookProcPtr): ExpDlgHookUPP;
  210.     {$IFC NOT GENERATINGCFM }
  211.     INLINE $2E9F;
  212.     {$ENDC}
  213.  
  214. FUNCTION CallExpModalFilterProc(theDialog: DialogPtr; VAR theEvent: EventRecord; itemOffset: INTEGER; VAR itemHit: INTEGER; yourDataPtr: Ptr; userRoutine: ExpModalFilterUPP): BOOLEAN;
  215.     {$IFC NOT GENERATINGCFM}
  216.     INLINE $205F, $4E90;
  217.     {$ENDC}
  218.  
  219. FUNCTION CallExpDlgHookProc(itemOffset: INTEGER; itemHit: INTEGER; theDialog: DialogPtr; yourDataPtr: Ptr; userRoutine: ExpDlgHookUPP): INTEGER;
  220.     {$IFC NOT GENERATINGCFM}
  221.     INLINE $205F, $4E90;
  222.     {$ENDC}
  223.  
  224. CONST
  225.     ioHasFormat                    = 0;
  226.     ioReadFormat                = 1;
  227.     ioNewFormat                    = 2;
  228.     ioWriteFormat                = 3;
  229.  
  230.     
  231. TYPE
  232.     FormatIOVerb = SignedByte;
  233.  
  234.  
  235. CONST
  236.     eoOpen                        = 0;
  237.     eoClose                        = 1;
  238.     eoOpenNew                    = 2;
  239.     eoCloseNew                    = 3;
  240.     eoCanSubscribe                = 4;
  241.  
  242.     
  243. TYPE
  244.     EditionOpenerVerb = SignedByte;
  245.  
  246.     FormatIOParamBlock = RECORD
  247.         ioRefNum:                LONGINT;
  248.         format:                    FormatType;
  249.         formatIndex:            LONGINT;
  250.         offset:                    LONGINT;
  251.         buffPtr:                Ptr;
  252.         buffLen:                LONGINT;
  253.     END;
  254.  
  255.     FormatIOProcPtr = ProcPtr;  { FUNCTION FormatIO(selector: ByteParameter; VAR PB: FormatIOParamBlock): INTEGER; }
  256.     EditionOpenerProcPtr = ProcPtr;  { FUNCTION EditionOpener(selector: ByteParameter; VAR PB: EditionOpenerParamBlock): INTEGER; }
  257.     FormatIOUPP = UniversalProcPtr;
  258.     EditionOpenerUPP = UniversalProcPtr;
  259.  
  260.     EditionOpenerParamBlock = RECORD
  261.         info:                    EditionInfoRecord;
  262.         sectionH:                SectionHandle;
  263.         document:                ^FSSpec;
  264.         fdCreator:                OSType;
  265.         ioRefNum:                LONGINT;
  266.         ioProc:                    FormatIOUPP;
  267.         success:                BOOLEAN;
  268.         formatsMask:            SignedByte;
  269.     END;
  270.  
  271. CONST
  272.     uppFormatIOProcInfo = $00000360; { FUNCTION (1 byte param, 4 byte param): 2 byte result; }
  273.     uppEditionOpenerProcInfo = $00000360; { FUNCTION (1 byte param, 4 byte param): 2 byte result; }
  274.  
  275. FUNCTION NewFormatIOProc(userRoutine: FormatIOProcPtr): FormatIOUPP;
  276.     {$IFC NOT GENERATINGCFM }
  277.     INLINE $2E9F;
  278.     {$ENDC}
  279.  
  280. FUNCTION NewEditionOpenerProc(userRoutine: EditionOpenerProcPtr): EditionOpenerUPP;
  281.     {$IFC NOT GENERATINGCFM }
  282.     INLINE $2E9F;
  283.     {$ENDC}
  284.  
  285. CONST
  286.     sectionEventMsgClass        = 'sect';
  287.     sectionReadMsgID            = 'read';
  288.     sectionWriteMsgID            = 'writ';
  289.     sectionScrollMsgID            = 'scrl';
  290.     sectionCancelMsgID            = 'cncl';
  291.  
  292.     currentEditionMgrVers        = $0011;
  293.  
  294. { Use InitEditionPackVersion(currentEditionMgrVers) instead of InitEditionPack }
  295.  
  296. FUNCTION InitEditionPackVersion(curEditionMgrVers: INTEGER): OSErr;
  297.     {$IFC NOT GENERATINGCFM}
  298.     INLINE $303C, $0100, $A82D;
  299.     {$ENDC}
  300. FUNCTION NewSection({CONST}VAR container: EditionContainerSpec; sectionDocument: ConstFSSpecPtr; kind: ByteParameter; sectionID: LONGINT; initalMode: UpdateMode; VAR sectionH: SectionHandle): OSErr;
  301.     {$IFC NOT GENERATINGCFM}
  302.     INLINE $303C, $0A02, $A82D;
  303.     {$ENDC}
  304. FUNCTION RegisterSection({CONST}VAR sectionDocument: FSSpec; sectionH: SectionHandle; VAR aliasWasUpdated: BOOLEAN): OSErr;
  305.     {$IFC NOT GENERATINGCFM}
  306.     INLINE $303C, $0604, $A82D;
  307.     {$ENDC}
  308. FUNCTION UnRegisterSection(sectionH: SectionHandle): OSErr;
  309.     {$IFC NOT GENERATINGCFM}
  310.     INLINE $303C, $0206, $A82D;
  311.     {$ENDC}
  312. FUNCTION IsRegisteredSection(sectionH: SectionHandle): OSErr;
  313.     {$IFC NOT GENERATINGCFM}
  314.     INLINE $303C, $0208, $A82D;
  315.     {$ENDC}
  316. FUNCTION AssociateSection(sectionH: SectionHandle; {CONST}VAR newSectionDocument: FSSpec): OSErr;
  317.     {$IFC NOT GENERATINGCFM}
  318.     INLINE $303C, $040C, $A82D;
  319.     {$ENDC}
  320. FUNCTION CreateEditionContainerFile({CONST}VAR editionFile: FSSpec; fdCreator: OSType; editionFileNameScript: ScriptCode): OSErr;
  321.     {$IFC NOT GENERATINGCFM}
  322.     INLINE $303C, $050E, $A82D;
  323.     {$ENDC}
  324. FUNCTION DeleteEditionContainerFile({CONST}VAR editionFile: FSSpec): OSErr;
  325.     {$IFC NOT GENERATINGCFM}
  326.     INLINE $303C, $0210, $A82D;
  327.     {$ENDC}
  328. FUNCTION OpenEdition(subscriberSectionH: SectionHandle; VAR refNum: EditionRefNum): OSErr;
  329.     {$IFC NOT GENERATINGCFM}
  330.     INLINE $303C, $0412, $A82D;
  331.     {$ENDC}
  332. FUNCTION OpenNewEdition(publisherSectionH: SectionHandle; fdCreator: OSType; publisherSectionDocument: ConstFSSpecPtr; VAR refNum: EditionRefNum): OSErr;
  333.     {$IFC NOT GENERATINGCFM}
  334.     INLINE $303C, $0814, $A82D;
  335.     {$ENDC}
  336. FUNCTION CloseEdition(whichEdition: EditionRefNum; successful: BOOLEAN): OSErr;
  337.     {$IFC NOT GENERATINGCFM}
  338.     INLINE $303C, $0316, $A82D;
  339.     {$ENDC}
  340. FUNCTION EditionHasFormat(whichEdition: EditionRefNum; whichFormat: FormatType; VAR formatSize: Size): OSErr;
  341.     {$IFC NOT GENERATINGCFM}
  342.     INLINE $303C, $0618, $A82D;
  343.     {$ENDC}
  344. FUNCTION ReadEdition(whichEdition: EditionRefNum; whichFormat: FormatType; buffPtr: UNIV Ptr; VAR buffLen: Size): OSErr;
  345.     {$IFC NOT GENERATINGCFM}
  346.     INLINE $303C, $081A, $A82D;
  347.     {$ENDC}
  348. FUNCTION WriteEdition(whichEdition: EditionRefNum; whichFormat: FormatType; buffPtr: UNIV Ptr; buffLen: Size): OSErr;
  349.     {$IFC NOT GENERATINGCFM}
  350.     INLINE $303C, $081C, $A82D;
  351.     {$ENDC}
  352. FUNCTION GetEditionFormatMark(whichEdition: EditionRefNum; whichFormat: FormatType; VAR currentMark: LONGINT): OSErr;
  353.     {$IFC NOT GENERATINGCFM}
  354.     INLINE $303C, $061E, $A82D;
  355.     {$ENDC}
  356. FUNCTION SetEditionFormatMark(whichEdition: EditionRefNum; whichFormat: FormatType; setMarkTo: LONGINT): OSErr;
  357.     {$IFC NOT GENERATINGCFM}
  358.     INLINE $303C, $0620, $A82D;
  359.     {$ENDC}
  360. FUNCTION GetEditionInfo(sectionH: SectionHandle; VAR editionInfo: EditionInfoRecord): OSErr;
  361.     {$IFC NOT GENERATINGCFM}
  362.     INLINE $303C, $0422, $A82D;
  363.     {$ENDC}
  364. FUNCTION GoToPublisherSection({CONST}VAR container: EditionContainerSpec): OSErr;
  365.     {$IFC NOT GENERATINGCFM}
  366.     INLINE $303C, $0224, $A82D;
  367.     {$ENDC}
  368. FUNCTION GetLastEditionContainerUsed(VAR container: EditionContainerSpec): OSErr;
  369.     {$IFC NOT GENERATINGCFM}
  370.     INLINE $303C, $0226, $A82D;
  371.     {$ENDC}
  372. FUNCTION GetStandardFormats({CONST}VAR container: EditionContainerSpec; VAR previewFormat: FormatType; preview: Handle; publisherAlias: Handle; formats: Handle): OSErr;
  373.     {$IFC NOT GENERATINGCFM}
  374.     INLINE $303C, $0A28, $A82D;
  375.     {$ENDC}
  376. FUNCTION GetEditionOpenerProc(VAR opener: EditionOpenerUPP): OSErr;
  377.     {$IFC NOT GENERATINGCFM}
  378.     INLINE $303C, $022A, $A82D;
  379.     {$ENDC}
  380. FUNCTION SetEditionOpenerProc(opener: EditionOpenerUPP): OSErr;
  381.     {$IFC NOT GENERATINGCFM}
  382.     INLINE $303C, $022C, $A82D;
  383.     {$ENDC}
  384. FUNCTION CallEditionOpenerProc(selector: ByteParameter; VAR PB: EditionOpenerParamBlock; routine: EditionOpenerUPP): OSErr;
  385.     {$IFC NOT GENERATINGCFM}
  386.     INLINE $303C, $052E, $A82D;
  387.     {$ENDC}
  388. FUNCTION CallFormatIOProc(selector: ByteParameter; VAR PB: FormatIOParamBlock; routine: FormatIOUPP): OSErr;
  389.     {$IFC NOT GENERATINGCFM}
  390.     INLINE $303C, $0530, $A82D;
  391.     {$ENDC}
  392. FUNCTION NewSubscriberDialog(VAR reply: NewSubscriberReply): OSErr;
  393.     {$IFC NOT GENERATINGCFM}
  394.     INLINE $303C, $0232, $A82D;
  395.     {$ENDC}
  396. FUNCTION NewSubscriberExpDialog(VAR reply: NewSubscriberReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookUPP; filter: ExpModalFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  397.     {$IFC NOT GENERATINGCFM}
  398.     INLINE $303C, $0B34, $A82D;
  399.     {$ENDC}
  400. FUNCTION NewPublisherDialog(VAR reply: NewPublisherReply): OSErr;
  401.     {$IFC NOT GENERATINGCFM}
  402.     INLINE $303C, $0236, $A82D;
  403.     {$ENDC}
  404. FUNCTION NewPublisherExpDialog(VAR reply: NewPublisherReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookUPP; filter: ExpModalFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  405.     {$IFC NOT GENERATINGCFM}
  406.     INLINE $303C, $0B38, $A82D;
  407.     {$ENDC}
  408. FUNCTION SectionOptionsDialog(VAR reply: SectionOptionsReply): OSErr;
  409.     {$IFC NOT GENERATINGCFM}
  410.     INLINE $303C, $023A, $A82D;
  411.     {$ENDC}
  412. FUNCTION SectionOptionsExpDialog(VAR reply: SectionOptionsReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookUPP; filter: ExpModalFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  413.     {$IFC NOT GENERATINGCFM}
  414.     INLINE $303C, $0B3C, $A82D;
  415.     {$ENDC}
  416.  
  417. {$ALIGN RESET}
  418. {$POP}
  419.  
  420. {$SETC UsingIncludes := EditionsIncludes}
  421.  
  422. {$ENDC} {__EDITIONS__}
  423.  
  424. {$IFC NOT UsingIncludes}
  425.  END.
  426. {$ENDC}
  427.